/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.util.LinkedList;

/**
 *
 * @author Stratos
 */
public class Passenger {

    String name;
    String surname;
    String type;
    Boolean wantsCard;
    //Boolean hasCard;
    Card card;
    String nearestStation;
    String goTo;

    public Passenger(String name, String surname, String type, Boolean wantsCard) {
        this.name = name;
        this.surname = surname;
        this.type = type;
        this.wantsCard = wantsCard;
        if (type.equalsIgnoreCase("Soldier")) {
            this.wantsCard = false;
        }
    }

    public Passenger() {
        RandomGenerator g = new RandomGenerator();
        this.name = g.generateName();
        this.name = g.generateSurname();
        this.type = g.generateType();
        this.wantsCard = g.generateBoolean();
    }
    
    public Station findMyStation(String nearestStation, LinkedList<Station> list) {
        Station myStation = null;
        for (Station station : list) {
            if (station.getName().equalsIgnoreCase(nearestStation)) {
                myStation = station;
                System.out.println("found your station!");
            }
        }
        return myStation;
    }
    
    public Boolean hasCard() {
        Boolean has = false;
        if (this.card == null) {
            has = false;
        } else if (this.card != null) {
            has = true;
        }
        return has;
    }
    
    public String whoAmI() {
        String str = "";
        str += "Όνομα: " + this.name + "\n";
        str += "Επώνυμο: " + this.surname + "\n";
        if (this.type.equalsIgnoreCase("Regular")) {
            str += "Είδος: Κανονικός επιβάτης/ρια" + "\n";
        } else if (this.type.equalsIgnoreCase("Student")) {
            str += "Είδος: Φοιτητής/ρια" + "\n";
        } else if (this.type.equalsIgnoreCase("Soldier")) {
            str += "Είδος: Οπλίτης/ρια" + "\n";
        }
        if(hasCard()) {
            str += "Κάρτα: Ναι" + "\n";
        } else {
            str += "Κάρτα: Όχι" + "\n";
        }
        if (wantsCard == true) {
            str += "Επιθυμεί κάρτα" + "\n";
        } else {
            str += "Δεν επιθυμεί κάρτα" + "\n";
        }
        str += "Αρχικός σταθμός: " + this.getNearestStation() + "\n";
        str += "Προορισμός: " + this.getGoTo() + "\n";
        
        return str;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Card getCard() {
        return card;
    }

    public void setCard(Card card) {
        this.card = card;
        this.wantsCard = false;
    }

    public String getNearestStation() {
        return nearestStation;
    }

    public void setNearestStation(String nearestStation) {
        this.nearestStation = nearestStation;
    }

    public String getGoTo() {
        return goTo;
    }

    public void setGoTo(String goTo) {
        this.goTo = goTo;
    }
    
    
    
}
